<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui"%>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>相似机构列表</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<br/>
<div class="Wrapper">
	<form id="similarForm">
    	<div class="fieldset1 tabel_col tabel_col_s clearFix ">
			<div class="caption">
					<span class="title">机构详情</span>
				</div>
			<div class="fieldBox col_33">
				<div class="label">融资机构名称：</div>
				<div class="field">
					<span  >${friBase.fundRasInsNm }</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">是否服务</div>
				<div class="field">
					<span >
					<c:if test="${friBase.isService=='1' }">
						是
					</c:if>
					<c:if test="${friBase.isService=='0' }">
						否
					</c:if>
					</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">优先级</div>
				<div class="field">
					<span>
					<c:if test="${not empty zgNum }">
						${zgNum }
					</c:if>
					<c:if test="${empty zgNum }">
						1
					</c:if>
					</span>
				</div>
			</div>
			 <!-- 机构限额信息 -->
		    <div class="caption">
				<span class="title">机构限额信息</span>
			</div>
			<div class="fieldBox col_33" style="display:none">
				<div class="label"></div>
				<div class="field">
				</div>
			</div>
		   <div style="width: 60%; ">
				<table style="BORDER-COLLAPSE: collapse;margin-bottom:20px" borderColor=#ECECEC height=40 cellPadding=1 width="100%" align=center border=1> 
				<thead>
					<tr style="background:#E7FEF4">
						<th class="tbLabel" style="text-align: center;height: 28px;">项目类型</th>
						<th class="tbLabel" style="text-align: center;height: 28px;">融资额上限（万）</th>
						<th class="tbLabel" style="text-align: center;height: 28px;">设备数上限（台）</th>
					</tr>
				</thead>
				<tbody>
				<c:forEach items="${friBase.fundRasInsLimList}" var="fundRasInsLim" begin="0">
				<tr>
					<td style="text-align: center;height: 28px;">${fundRasInsLim.PRJ_TYP}</td>
					<td style="text-align: center;height: 28px;">${fundRasInsLim.INS_LIM_AMT_}</td>
					<td style="text-align: center;height: 28px;">${fundRasInsLim.INS_LIM_NUM_}</td>
				</tr>
				</c:forEach>
				</table>
			</div>
			 <!-- 机构相似度 -->
		    <div class="caption">
				<span class="title">机构相似度</span>
			</div>
			<div class="fieldBox col_33" style="display:none">
				<div class="label"></div>
				<div class="field">
				</div>
			</div>
			<div id="ligergrid1" class="sq-grid" style="height: 372px;"></div>
		</div>
   </form>
        
        
</div>
<script type="text/javascript">
var grid = null;
var limitGrid = null;
var mainFundInsId = '${mainFundInsId}';//当前主机构
$(function () {
	//initLimitGrid();//初始化机构限额信息列表
	initGrid();//初始化相似列表
});
//初始化机构限额信息列表
<%-- function initLimitGrid() {
	$("#similarForm").ligerForm({validate: true});
	var _url = '<%=path%>/rfbase/fundInsSimilarInfo/initLimGrid.do';
	$("#limitGrid").ligerGrid({
		url : _url,
		method : 'get',
		parms : {"mainFundInsId":mainFundInsId},
    	columns: [
            { display: '项目类型', name: 'financingTypeNm', width: 100},
            { display: '融资额上限（万）', name: 'cstNm', width: 150 },
            { display: '设备数上限（台）', name: 'cstTypNm', width: 100 }
        ],
        root:'rows',
        record:'total',
        hideLoadButton : true,
        width: '60%',
        height:'200px',
        heightDiff:-2,
        checkbox:false,
        rownumbers:true
	});
	limitGrid = liger.get("limitGrid");
} --%>
//初始化列表
function initGrid() {
	$("#similarForm").ligerForm({validate: true});
	var _url = '<%=path%>/rfbase/fundInsSimilarInfo/initList.do';
	$("#ligergrid1").ligerGrid({
		url : _url,
		method : 'get',
		parms : {"mainFundInsId":mainFundInsId},
    	columns: [
    		//{ display: '机构名称', name: 'id', width: 180},
            { display: '机构名称', name: 'fundRasInsNm', width: 220},
            { display: '业务线', name: 'bussinessLineNm', width: 100},
            { display: '是否服务', name: 'isService', width: 150,
            	render:function (rowdata, rowindex, value){
					 var h="";
					 if(rowdata.isService=='1'){
						 h='是';
					 }else {
						 h='否';
	                 }
					 return h;
				 }
            },
          //  { display: '优先级', name: 'zgNum', width: 100 },
            {display: '优先级', minWidth: 100,
            	render: function (rowdata, rowindex, value){
            		var h='';
                    if(rowindex==0){
                    	h="<img width='40px' height='20px' src='<%=path%>/resource/lib/images/u147.png'/>";
                    	h+="  ";
                    	h+="<img width='40px'  onclick='change("+rowdata.id+",0,"+rowdata.mainFundInsId+")' height='20px' src='<%=path%>/resource/lib/images/u145.png'/>";
                    }else if(grid.data.total==(rowindex+1)){
                    	h="<img width='40px'  onclick='change("+rowdata.id+",1,"+rowdata.mainFundInsId+")' height='20px' src='<%=path%>/resource/lib/images/u143.png'/>";
                    	h+="  ";
                    	h+="<img width='40px'  height='20px' src='<%=path%>/resource/lib/images/u161.png'/>";
                    }else{
                    	h="<img width='40px'  onclick='change("+rowdata.id+",1,"+rowdata.mainFundInsId+")' height='20px' src='<%=path%>/resource/lib/images/u143.png'/>";
                    	h+="  ";
                    	h+="<img width='40px' onclick='change("+rowdata.id+",0,"+rowdata.mainFundInsId+")' height='20px' src='<%=path%>/resource/lib/images/u145.png'/>";
                    }
                   
                    return h;
                }
            
            }
           
        ],
        usePager: false,
        root:'rows',
        record:'total',
        isScroll: true,
        hideLoadButton : true,
        width: '60%',
        height:'100%',
        heightDiff:-2,
        checkbox:false,
        rownumbers:true
	});
    grid = liger.get("ligergrid1");
    grid.setHeight(100);
}
function change(id,num,mainFundInsId){
	  $.ajax({
		type: 'post',
		dataType:'json',
		data:{
			'id':id,
			'num':num,
			'mainFundInsId':mainFundInsId
		},
		url: '<%=path%>/rfbase/fundInsSimilarInfo/changeNum.do',
		beforeSend: function(){
			wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
		},
			success : function(msg) {
				wait_dialog.close();
				if (msg.success == 1) {
					grid.reload();
				} else {
					UIUtils.alertErrorHold1(msg.info);
				}
			}
		});
	  }
</script>
</body>
</html>
